//
//  ZDNetworkTool.h
//  OCSinaWeiBo
//
//  Created by Apple on 15/10/29.
//  Copyright © 2015年 itcast. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

typedef void (^ZDCompletionBlock)();

@interface ZDNetworkTool : NSObject


/**
 *  返回单例
 */
+ (instancetype)sharedInstance;


/**
 *  返回授权URL
 */
- (NSURL *)authURL;


/**
 *  加载accessToken
 *
 *  @param code         授权成功 返回的code
 *  @param successBlock 请求成功回调
 *  @param failureBlock 请求失败回调
 */
- (void)loadAccessToken:(NSString *)code success:(void (^)(id responseObject))successBlock failure:(void (^)(NSError *error))failureBlock;

/**
 *  加载用户信息
 *
 *  @param access_token access_Token
 *  @param uid          uid
 *  @param successBlock 请求成功回调
 *  @param failureBlock 请求失败回调
 */
- (void)loadUserInfoWithAccess_token:(NSString *)access_token uid:(NSString *)uid success:(void (^)(id responseObject))successBlock failure:(void (^)(NSError *error))failureBlock;


/**
 *  加载微博数据
 *
 *  @param access_token access_Token
 *  @param since_id     若指定此参数，则返回ID比since_id大的微博（即比since_id时间晚的微博），默认为0
 *  @param max_id       若指定此参数，则返回ID小于或等于max_id的微博，默认为0
 *  @param successBlock 请求成功回调
 *  @param failureBlock 请求失败回调
 */
- (void)loadStatusesWithAccess_token:(NSString *)access_token since_id:(int64_t)since_id max_id:(int64_t)max_id success:(void (^)(id responseObject))successBlock failure:(void (^)(NSError *error))failureBlock;


/**
 *  发微博
 *
 *  @param status       微博内容
 *  @param image        微博配图  新浪默认最多可上传9张，但是开发账号只能上传一张，所以这里只要求传入一张
 *  @param access_token access_token
 *  @param successBlock 成功回调
 *  @param failureBlock 失败回调
 */
- (void)sendStatus:(NSString *)status image:(UIImage *)image access_token:( NSString *)access_token success:(void (^)(id   responseObject))successBlock failure:(void (^)(NSError * error))failureBlock;

@end
